<%
/**
 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
%>

<%@ include file="/html/portlet/ext/reports/init.jsp" %>
<%@ page import="org.apache.commons.beanutils.BeanComparator"%>
<%@ page import="com.ext.portlet.reports.service.persistence.ReportsEntryUtil"%>

<%
String entryId = ParamUtil.getString(request, "entryId");
ReportsEntry re = ReportsEntryUtil.findByPrimaryKey(Long.parseLong(entryId));

		long mill = re.getModifiedDate().getTime() - re.getCreateDate().getTime();
  		long time = mill / 1000;  
  		int seconds = ((int)(time % 60));  
   		int minutes = ((int)((time % 3600) / 60));  
   		int hours = ((int)(time / 3600));	

%>
<portlet:renderURL  windowState="<%= WindowState.NORMAL.toString() %>" var="cancelEntryURL" >
	<portlet:param name="struts_action" value="/ext/reports/view_reports" />			
</portlet:renderURL>

<form action="<%= cancelEntryURL.toString() %>" method="POST" name="<portlet:namespace />fm1">	
<center>
<table width='100%' class='portlet-box' align='center' cellspacing="0" cellpadding="2">
<tr class='results-header'>
		<td class='portlet-font' colspan='3' style='font-weight:bold;height:25px' nowrap>
		Dash Board 
		</td>
		<tr class = "portlet-section-body results-row alt">
		<td><b>Name:</b> </td><td><%= re.getName()%></td>
		</tr>		
		<tr class = "portlet-section-body results-row">
		<td><b>Country - Region - City :</b></td><td><%=re.getCountry()%> - <%=re.getRegion()%> - <%=re.getCity()%></td>
		</tr>
		<tr class = "portlet-section-body results-row alt">
		<td><b>Log in :</b></td><td><%= re.getCreateDate()%></td>
		</tr>
		<tr class = "portlet-section-body results-row">
		<td><b>Log Out :</b></td><td><%= re.getModifiedDate()%></td>
		</tr>
		<tr class = "portlet-section-body results-row alt">
		<td><b>Interval Time :</b></td><td><%= hours + " hr " + minutes + " min " +seconds+ " sec "%></td>
		</tr>
		<tr class = "portlet-section-body results-row">
		<td><b>Viewed Pages :</b></td><td><%= (re!=null?re.getPages():"WELCOME")%></td>
		</tr>
		<tr class = "portlet-section-body results-row alt">
		<td><b>Hits :</b></td><td><%= re.getHit()%></td>
		</tr>
		<tr class = "portlet-section-body results-row">
		<td><b>IP :</td><td><%= re.getRemoteAddr()%></td>
		</tr>
		<tr class = "portlet-section-body results-row alt">
		<td><b>Email :</b></td><td><%= re.getEmail()%></td>
		</tr>
		<tr class = "portlet-section-body results-row">
		<td><b>Agent :</b></td><td><%= re.getUserAgent()%></td>
		</tr>
		<tr>
		<td></td>
		<td align="center"><input type="submit" value="CANCEL"/></td>
		</tr>
</tr>
</table>
</center>
</form>	

